
<%@ page import="librarymanager.Book" %>
<!DOCTYPE html>
<html>
    <head>
        <meta name="layout" content="main">
        <g:set var="entityName" value="${message(code: 'book.label', default: 'Book')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
        <a href="#list-book" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
        <div class="nav" role="navigation">
            <ul>
                <li><a class="home" href="${createLink(uri: '/book/index')}"><g:message code="default.home.label"/></a></li>
                <sec:access url="/book/create/">
                        <li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
                </sec:access>   
                <li style="float:right;">Logged in as <sec:username/> 
                    (<g:form style="display:inline;" controller="logout" action="index" method="post">
                        <g:submitButton name="logout" value="Logout" />
                    </g:form>)
                </li>
            </ul>
            </div>
            <style>
                    #input {
                        margin-left: 20px;
                        margin-top: 20px;
                    }
            </style>
            <div id='input'>
                <g:form name="queryForm" action="insecure" method="get">
                    Title:
                    <g:textField name="title" value="${params?.title}" />
                    <g:submitButton name="searchButton" value="Search" />
                </g:form>
            </div>
            <div id="list-book" class="content scaffold-list" role="main">
                <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
                <div class="message" role="status">${flash.message}</div>
            </g:if>
            <g:if test="${bookInstanceList}">
            <table>
                <thead>
                    <tr>

                        <g:sortableColumn property="title" title="${message(code: 'book.title.label', default: 'Title')}" />

                        <g:sortableColumn property="category" title="${message(code: 'book.category.label', default: 'Category')}" />

                        <th><g:message code="book.author.label" default="Author" /></th>

                    </tr>
                </thead>
                <tbody>
                    <g:each in="${bookInstanceList}" status="i" var="bookInstance">
                        <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">

                            <td><g:link action="show" id="${bookInstance.id}">${fieldValue(bean: bookInstance, field: "title")}</g:link></td>

                            <td>${fieldValue(bean: bookInstance, field: "category")}</td>

                            <td>${fieldValue(bean: bookInstance, field: "author")}</td>

                        </tr>
                    </g:each>
                </tbody>
            </table>
            </g:if>
            <div class="pagination">
                <%--<g:paginate total="${bookInstanceCount ?: 0}" />--%>
            </div>
        </div>
    </body>
</html>
